<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div{
            width: 100px;
            height: 100px;
            background-color: red;
            color: yellow;
        }
        div p{
            width: 50px;
            /* height: 50px; */
            height: inherit;     /*高度不会默认继承父级元素，设置inherit默认继承*/
            background-color: blue;
            color: initial;     /*颜色会默认继承父级元素，设置initial默认不继承*/
        }
    </style>
</head>
<body>
    <div>hello
        <p>world</p>
    </div>
</body>
</html>